package com.example.wanandroid.room


import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.wanandroid.entity.banner.Banner

@Dao
interface BannerDao {
    @Query("SELECT * FROM banner")
    fun getBanners(): List<Banner>

    @Query("SELECT * FROM banner WHERE id = :userId")
    fun getBannerById(userId: Int): Banner?

    @Insert(onConflict = OnConflictStrategy.REPLACE) //重复时则会替换
    fun insert(user: Banner)

    @Delete
    fun delete(user: Banner)

    @Update
    fun update(user: Banner)
}
